$(document).ready(function(){
  //收藏本站
  $('.favorite_btn').click(function(){
	  var sTitle = document.title;
	  var sURL = location.href;			
	  try{
		  window.external.AddFavorite(sURL, sTitle);
	  }catch(e){
		 try{
			  window.sidebar.addPanel(sTitle, sURL, "");
		  }catch (e){
			  alert("加入收藏失败，请使用Ctrl+D进行添加");
		  }
	  }
  });
  $('.submit_yundan').click(function(){
	  var yundan = $("#ydh").val();
	  if (yundan==""){
		   alert("请输入运单号码");$("#ydh").focus();return false;
	  }else{
	     if(/[\u4e00-\u9fa5]/g.test(yundan)){ alert("运单号码不能包含汉字");$("#ydh").focus();return false; }
	  }
  });
  //首页登录框-验证登录
  $("#btnLogin").click(function() {
	  if ($("#username").val()==""){			
		  alert("请输入用户名"); $("#username").focus();return false;
	  }else if($("#password").val()==""){	
		  alert("请输入密码！"); $("#password").focus();return false;
	  }else{
		$.post("index.php", {"app":"member", "act":"login_index", "username": $("#username").val(),"password": $("#password").val()},
		function (data,textStatus){
			if (data.indexOf("err")+1){			
				$("#password").attr("value","");
				alert("帐号或者密码错误");
			}else{
				 $("body").append(data);
			}
		 })	
	  }
	  return false;
  }); 
  /* 全选 */
  $('.checkall').click(function(){
	  var _self = this;
	  $('.checkitem').each(function(){
		  if (!this.disabled)
		  {
			  $(this).attr('checked', _self.checked);
		  }
	  });
	  $('.checkall').attr('checked', this.checked);
  });   
});